
import React, {Fragment} from "react";
import {Button, Icon, Modal, Result, Typography} from "antd";
import {observer} from "mobx-react";
import Store from "./Store";

@observer
class ResultModal extends React.Component{
    constructor(props) {
        super(props);
        this.state = {}
    }

    render() {
        const { Paragraph, Text } = Typography;
        return (
            <Fragment>
                <Modal
                    width={800}
                    title="执行结果"
                    visible={Store.resultVisible}
                    footer={null}
                    onCancel={() => Store.resultVisible = false}
                >
                    <Result
                        status={Store.status}
                        title={Store.title}
                        subTitle={Store.subTitle}
                    >
                        {Store.processList.length > 0 && <div className="desc">
                            <Paragraph>
                                <Text
                                    strong
                                    style={{
                                        fontSize: 16,
                                    }}
                                >
                                    执行结果如下:
                                </Text>
                            </Paragraph>
                            {Store.processList.map((item,index) => (
                                <Paragraph key={index}>
                                    {
                                        item["status"] === "success"
                                            ?
                                            <Icon twoToneColor="#52c41a" theme="twoTone"  type="check-circle" style={{marginRight:"5px"}} />
                                            :
                                            <Icon twoToneColor="#eb2f96" theme="twoTone"  type="close-circle" style={{marginRight:"5px"}} />
                                    }
                                    {item["description"]}
                                </Paragraph>
                            ))}

                        </div>}
                    </Result>
                </Modal>
            </Fragment>
        );
    }
}

export default ResultModal;
